package com.ls.herostory.util;

public class InterfaceClassFilter implements ClassFilter{

    private Class interfaceClass;

    public InterfaceClassFilter(Class interfaceClass) {
        this.interfaceClass = interfaceClass;
    }

    @Override
    public boolean accept(Class clazz) {
        Class[] interfaces = clazz.getInterfaces();
        if(interfaces != null){
            for (Class itf : interfaces) {
                return itf.isAssignableFrom(interfaceClass);
            }
        }

        return false;
    }

}